package com.fullstuck.aop;

import org.aspectj.lang.ProceedingJoinPoint;

/**
 * 切面
 * 配置在 applicationContext-aop.xml
 */
public class MyAspect {

    public void before(){
        System.out.println("前置增强");
    }

    public void afterReturning(){
        System.out.println("后置增强 程序成功时才执行");

    }

    public Object around(ProceedingJoinPoint point) throws Throwable {
        System.out.println("环绕前置增强");
        Object proceed = point.proceed();
        System.out.println("环绕后置增强");
        return proceed;

    }

    public void afterThrowing(){
        System.out.println("异常抛出");

    }

    public void after(){
        System.out.println("最终增强，不管是否报错都会执行");
    }
}
